<template>
	<view class="contents">
		<view style="height: 20rpx;"></view>
		<view class="oredr_list" v-for="(item,index) in refundList" :key="index">
			<view class="order_head">
				<view class="order">
					<view class="allselect">
						<view>订单编号：{{item.order_id}}</view>
					</view>
				</view>
			</view>
			<view class="fengexian"></view>
			<view class="order_content">
				<view class="order_img">
					<image :src="item.cartInfo[0].productInfo.image" mode=""></image>
				</view>
				<view class="order_text">
					<view class="order_title">
						{{item.cartInfo[0].productInfo.store_name}}
					</view>
					<view class="promise">
						破损包退
					</view>
					<view class="order_detail">
						规格:{{item.cartInfo[0].productInfo.give_gold_num}}{{item.cartInfo[0].productInfo.unit_name}}装
					</view>
				</view>
			</view>
			<view class="order_bottom">
				<view class="chexiao" @click="gotoRefund(item.order_id)" v-if="item._status._type== -1 ">
					撤销申请
				</view>
				<view class="apply" @click="gotoRefund(item.order_id,item._status._type)">
					{{item._status._type==-1?item._status._title:item._status._title}}
				</view>
			</view>
		</view>
		<view class="footer" v-if="refundList.length==0">
			暂无售后订单
		</view>
	</view>

</template>

<script>
	import {
		myOrder
	} from '@/api/api.js'
	export default {
		data() {
			return {
				refundList:[]
			}
		},
		onLoad() {
				this.init(1,4)
		},
		methods: {
			gotoRefund(id,type) {
				if(type == -3 || type == -4 ){
					uni.navigateTo({
						url:`/myIndex/returnDetails_02/returnDetails_02?orderId=${id}`
					})
				}
				uni.navigateTo({
					url: `/myIndex/returnDetails/returnDetails?orderId=${id}`
				})
			},
			init(page, type) {
				if (page == undefined) {
					page = 1
				}
				let data = `first=${page}&limit=${10}&type=${type}`
				myOrder(data).then(res => {
					if (res.data.code == '200') {
						this.refundList = res.data.data.list
					} else {}
					console.log(res)
				})
			},
		},
	}
</script>

<style scoped lang='scss'>
	.contents {
		width: 100%;
		min-height: 100vh;
		background-color: rgb(247, 249, 252);

		.oredr_list {
			width: 694rpx;
			height: 392rpx;
			background-color: #fff;
			border-radius: 10rpx;
			margin: 35rpx auto 0;

			.order_head {
				box-sizing: border-box;
				padding: 0 28rpx;
				width: 100%;
				height: 80rpx;
				line-height: 80rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 26rpx;

				.order {
					color: #999999;
				}

			}

			.order_content {
				box-sizing: border-box;
				padding: 0 28rpx;
				width: 100%;
				height: 182rpx;
				display: flex;

				.order_img {
					width: 182rpx;
					height: 182rpx;
					flex-shrink: 0;

					image {
						border-radius: 8rpx;
						width: 100%;
						height: 100%;
					}
				}

				.order_text {
					margin-left: 30rpx;
					width: 470rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.order_title {
						/* margin-top: 10rpx; */
						width: 100%;
						height: 40rpx;
						line-height: 40rpx;
						font-size: 30rpx;
						color: #333;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						-o-text-overflow: ellipsis;
					}

					.order_detail {
						margin-top: 10rpx;
						width: 470rpx;
						height: 40rpx;
						line-height: 40rpx;
						font-size: 26rpx;
						color: #999999;
						text-overflow: ellipsis;
						white-space: nowrap;
						overflow: hidden;
					}

					.promise {
						color: rgb(245, 37, 38);
						font-size: 20rpx;
						margin-top: 10rpx;
					}
				}
			}

			.fengexian {
				width: 640rpx;
				border: 1rpx solid #EEEEEE;
				margin: 0 auto 30rpx;
			}

			.order_bottom {
				/* width: 100%; */
				display: flex;
				padding: 0 25rpx;
				justify-content: flex-end;
				align-items: center;
				margin-top: 25rpx;
				.chexiao {
					font-size: 24rpx;
					margin-right: 20rpx;
					border: 2rpx solid rgb(123, 123, 123);
					color: rgb(123, 123, 123);
					width: 162rpx;
					height: 52rpx;
					text-align: center;
					line-height: 52rpx;
					border-radius: 34rpx;
				}
				.apply {
					width: 185rpx;
					height: 52rpx;
					border: 2rpx solid rgb(123, 123, 123);
					border-radius: 34rpx;
					color: rgb(123, 123, 123);
					font-size: 24rpx;
					text-align: center;
					line-height: 52rpx;
					/* margin-left: 500rpx; */
				}
			}
		}
        .footer {
			text-align: center;
			color: #999999;
		}
	}
</style>
